<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!--给a标签return false 截断a标签跳转新页面-->
<a href="#" onclick="alert('你好啊!')";return false>跳转1</a>
<a href="#" onclick=test1();return false>跳转2</a>
<a href="#" onclick=test3();>跳转3</a>
</body>
<script>
    function test1() {
        alert('我是跳转2');
    }
    function test3() {
        alert('我是跳转3');
        return false;
    }
</script>
</html>